<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>农民基本信息</title>
    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/static/admin/style.css}" media="all">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/admin/style.css}" media="all">
    <link rel="stylesheet" th:href="@{/layui/css/element-index.css}" media="all">
    <script type="text/html" id="indexTpl">
        {{d.LAY_TABLE_INDEX+1}}
    </script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form layui-form-pane" action="">
                <input name="id" th:value="${obj?.id}" class="layui-input layui-hide">
                <div class="layui-form-item">
                    <label class="layui-form-label">事务类型</label>
                    <div class="layui-input-block">
                        <input type="text" name="type" th:value="${obj?.type}" lay-verify="required" placeholder="请输入事务类型" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="titles" th:value="${obj?.titles}" lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">上传图片</label>
                    <div class="layui-input-block">
                        <input type="file" name="image" id="imageUpload" accept="image/*" class="layui-input" onchange="previewImage(event)">
                        <img id="imagePreview" src="#" alt="预览图片" style="display:none; margin-top:10px; width:100px; height:100px;">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <input type="text" name="description" th:value="${obj?.description}" lay-verify="required" placeholder="请输入描述" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">开始时间</label>
                    <div class="layui-input-block">
                        <input type="text" name="startdate" id="startdate" th:value="${obj?.startdateStr}" lay-verify="required" placeholder="请选择开始时间" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">结束时间</label>
                    <div class="layui-input-block">
                        <input type="text" name="enddate" id="enddate" th:value="${obj?.enddateStr}" lay-verify="required" placeholder="请选择结束时间" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <input type="text" name="sates" th:value="${obj?.sates}" lay-verify="required" placeholder="请输入状态" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">事务负责人</label>
                    <div class="layui-input-block">
                        <input type="text" name="person" th:value="${obj?.person}" lay-verify="required" placeholder="请输入事务负责人" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注信息</label>
                    <div class="layui-input-block">
                        <input type="text" name="remarks" th:value="${obj?.remarks}" lay-verify="required" placeholder="请输入备注信息" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-hide">
                    <input type="button" lay-submit lay-filter="LAY-front-submit" id="LAY-front-submit" value="确认">
                </div>
            </form>
        </div>
    </div>
</div>

<script th:src="@{/static/layui/layui.js}"></script>
<script  th:src="@{/layui/layui.js}"></script>
<script src="/layui/lay/modules/jquery.js" th:src="@{/layui/lay/modules/jquery.js}"></script>
<script src="/layui/lay/modules/table.js" th:src="@{/layui/lay/modules/table.js}"></script>
<script src="/layui/lay/modules/element-index.js" th:src="@{/layui/lay/modules/element-index.js}"></script>
<script>
    layui.use(['form','laydate'],function () {
        var $ = layui.$;
        var laydate = layui.laydate;
        var form = layui.form;

        //支持日期控件
        laydate.render({
            elem:'#startdate', //但这里日期能显示出来 但是 闪退
            trigger:'click'
        });
        laydate.render({
            elem:'#enddate', //但这里日期能显示出来 但是 闪退
            trigger:'click'
        });


    });
    // 图片预览
    function previewImage(event) {
        var imagePreview = document.getElementById('imagePreview');
        var file = event.target.files[0];
        var reader = new FileReader();

        reader.onload = function(){
            imagePreview.src = reader.result;
            imagePreview.style.display = 'block';
        }

        if (file) {
            reader.readAsDataURL(file);
        } else {
            imagePreview.src = '#';
            imagePreview.style.display = 'none';
        }
    }
</script>
</body>
</html>